<template>
    <div class="myphoto">
        <div class="top">
            <div class="left">
                <el-button type="primary" icon="ArrowLeft" circle size="small" @click="back" />
                <span class="zuo">我的相册</span>
            </div>
            <div class="right">
                <el-button type="primary" @click="back">返回</el-button>
            </div>
        </div>
        <div class="content" v-for="item, index in list" :key="index">
            <div class="text">
                <el-avatar src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
                <div class="wenzi">
                    <p>{{ item.name }}</p>
                    <p>{{ item.initTime }}</p>
                </div>
            </div>
            <div class="miaoshu">
                <p>{{ item.detail }}</p>
            </div>
            <div class="img">
                <div class="one" v-for="items in list[index].photoList">
                    <img :src="items.img" alt="">
                </div>
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
import server from "@/api/index";
import { ref, onMounted } from 'vue'
import { useRouter } from "vue-router";
var router = useRouter();
var list = ref()
onMounted(async () => {
    var res = await server.home.photos_getPhotosByTeacherName('kwl')
    // console.log(res.data.data);
    list.value = res.data.data
    list.value.forEach((item: any) => {
        // console.log(item.photoList);
        for (var key in item.photoList) {
            item.photoList[key].img = "http://43.143.177.23:8080" + item.photoList[key].img
            // console.log(item.photoList[key].img); 
        }
    })
})
var back = () => {
    router.go(-1)
}
</script>

<style scoped>
.top {
    width: 100%;
    height: 70px;
    border-bottom: 1px solid #ccc;
    box-shadow: 0px 0px 3px;
    line-height: 70px;
    position: sticky;
    background: #fff;
    top: 0;
}

.left {
    float: left;
    margin-left: 20px;
}

.right {
    float: right;
    margin-right: 20px;
}

.zuo {
    margin-left: 10px;
    color: blue;
}

.content {
    width: 1200px;
    /* background: #aaa; */
    /* height: 1000px; */
    margin: 80px auto 0 auto;
}

.text {
    width: 100%;
    /* background: #ccc; */
    display: flex;
}

.wenzi {
    margin-left: 30px;
    font-size: 14px;
    color: #ccc;
}

.wenzi p:nth-child(2) {
    line-height: 28px;
}

.miaoshu {
    width: 100%;
    margin-left: 70px;
    line-height: 60px;
}

.img {
    width: 1130px;
    margin-left: 70px;
    /* background: #ccc; */
    height: 500px;
    border-bottom: 1px solid #ccc;
    padding-bottom: 50px;
    display: flex;
    flex-wrap: wrap;
    justify-content: start;
}

.one {
    width: 31%;
    height: 210px;
    /* background: red; */
    border-radius: 5px;
    margin: 0 20px 0 0;
}

.one img {
    width: 100%;
    height: 100%;
}
</style>